.class public Lrexsee/advertisement/RexseeAdBars;
.super Ljava/lang/Object;
.source "RexseeAdBars.java"

# interfaces
.implements Lrexsee/core/browser/clazz/JavascriptInterface;


# static fields
.field public static final EVENT_ONADLOADCLICKED:Ljava/lang/String; = "onAdClicked"

.field public static final EVENT_ONADLOADFAILED:Ljava/lang/String; = "onAdLoadFailed"

.field public static final EVENT_ONADLOADSUCCESSED:Ljava/lang/String; = "onAdLoadSuccessed"

.field private static final INTERFACE_NAME:Ljava/lang/String; = "AdBars"


# instance fields
.field private final mActivity:Landroid/app/Activity;

.field private final mBrowser:Lrexsee/core/browser/Browser;

.field private final mLayout:Lrexsee/core/browser/clazz/RootViewInterface;

.field private final mMap:Ljava/util/HashMap;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/HashMap",
            "<",
            "Ljava/lang/String;",
            "Lrexsee/advertisement/AdDiv;",
            ">;"
        }
    .end annotation
.end field

.field private syncTag:Z


# direct methods
.method public constructor <init>(Lrexsee/core/browser/clazz/RootViewInterface;)V
    .locals 2
    .param p1, "rootView"    # Lrexsee/core/browser/clazz/RootViewInterface;

    .prologue
    .line 40
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 37
    const/4 v0, 0x0

    iput-boolean v0, p0, Lrexsee/advertisement/RexseeAdBars;->syncTag:Z

    .line 41
    iput-object p1, p0, Lrexsee/advertisement/RexseeAdBars;->mLayout:Lrexsee/core/browser/clazz/RootViewInterface;

    .line 42
    invoke-interface {p1}, Lrexsee/core/browser/clazz/RootViewInterface;->getBrowser()Lrexsee/core/browser/Browser;

    move-result-object v0

    iput-object v0, p0, Lrexsee/advertisement/RexseeAdBars;->mBrowser:Lrexsee/core/browser/Browser;

    .line 43
    iget-object v0, p0, Lrexsee/advertisement/RexseeAdBars;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v0, v0, Lrexsee/core/browser/Browser;->eventList:Lrexsee/core/browser/clazz/EventList;

    const-string v1, "onAdLoadSuccessed"

    invoke-virtual {v0, v1}, Lrexsee/core/browser/clazz/EventList;->add(Ljava/lang/String;)V

    .line 44
    iget-object v0, p0, Lrexsee/advertisement/RexseeAdBars;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v0, v0, Lrexsee/core/browser/Browser;->eventList:Lrexsee/core/browser/clazz/EventList;

    const-string v1, "onAdLoadFailed"

    invoke-virtual {v0, v1}, Lrexsee/core/browser/clazz/EventList;->add(Ljava/lang/String;)V

    .line 45
    iget-object v0, p0, Lrexsee/advertisement/RexseeAdBars;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v0, v0, Lrexsee/core/browser/Browser;->eventList:Lrexsee/core/browser/clazz/EventList;

    const-string v1, "onAdClicked"

    invoke-virtual {v0, v1}, Lrexsee/core/browser/clazz/EventList;->add(Ljava/lang/String;)V

    .line 46
    iget-object v0, p0, Lrexsee/advertisement/RexseeAdBars;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {v0}, Lrexsee/core/browser/Browser;->getContext()Landroid/content/Context;

    move-result-object v0

    check-cast v0, Landroid/app/Activity;

    iput-object v0, p0, Lrexsee/advertisement/RexseeAdBars;->mActivity:Landroid/app/Activity;

    .line 47
    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    iput-object v0, p0, Lrexsee/advertisement/RexseeAdBars;->mMap:Ljava/util/HashMap;

    .line 48
    return-void
.end method

.method static synthetic access$0(Lrexsee/advertisement/RexseeAdBars;)Lrexsee/core/browser/Browser;
    .locals 1

    .prologue
    .line 35
    iget-object v0, p0, Lrexsee/advertisement/RexseeAdBars;->mBrowser:Lrexsee/core/browser/Browser;

    return-object v0
.end method

.method static synthetic access$1(Lrexsee/advertisement/RexseeAdBars;)Lrexsee/core/browser/clazz/RootViewInterface;
    .locals 1

    .prologue
    .line 34
    iget-object v0, p0, Lrexsee/advertisement/RexseeAdBars;->mLayout:Lrexsee/core/browser/clazz/RootViewInterface;

    return-object v0
.end method

.method static synthetic access$2(Lrexsee/advertisement/RexseeAdBars;)Ljava/util/HashMap;
    .locals 1

    .prologue
    .line 36
    iget-object v0, p0, Lrexsee/advertisement/RexseeAdBars;->mMap:Ljava/util/HashMap;

    return-object v0
.end method

.method static synthetic access$3(Lrexsee/advertisement/RexseeAdBars;Z)V
    .locals 0

    .prologue
    .line 37
    iput-boolean p1, p0, Lrexsee/advertisement/RexseeAdBars;->syncTag:Z

    return-void
.end method


# virtual methods
.method public create(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    .locals 7
    .param p1, "id"    # Ljava/lang/String;
    .param p2, "adVendor"    # Ljava/lang/String;
    .param p3, "adKey"    # Ljava/lang/String;
    .param p4, "style"    # Ljava/lang/String;

    .prologue
    .line 74
    iget-object v0, p0, Lrexsee/advertisement/RexseeAdBars;->mMap:Ljava/util/HashMap;

    invoke-virtual {v0, p1}, Ljava/util/HashMap;->containsKey(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_1

    .line 96
    :cond_0
    :goto_0
    return-void

    .line 75
    :cond_1
    invoke-static {p2}, Lrexsee/advertisement/AdDiv;->isVendorReady(Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_2

    .line 76
    iget-object v0, p0, Lrexsee/advertisement/RexseeAdBars;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Lrexsee/advertisement/RexseeAdBars;->getInterfaceName()Ljava/lang/String;

    move-result-object v1

    const-string v2, "The specified AD vendor is not ready."

    invoke-virtual {v0, v1, v2}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0

    .line 79
    :cond_2
    const/4 v0, 0x0

    iput-boolean v0, p0, Lrexsee/advertisement/RexseeAdBars;->syncTag:Z

    .line 80
    iget-object v6, p0, Lrexsee/advertisement/RexseeAdBars;->mActivity:Landroid/app/Activity;

    new-instance v0, Lrexsee/advertisement/RexseeAdBars$1;

    move-object v1, p0

    move-object v2, p1

    move-object v3, p2

    move-object v4, p3

    move-object v5, p4

    invoke-direct/range {v0 .. v5}, Lrexsee/advertisement/RexseeAdBars$1;-><init>(Lrexsee/advertisement/RexseeAdBars;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    invoke-virtual {v6, v0}, Landroid/app/Activity;->runOnUiThread(Ljava/lang/Runnable;)V

    .line 89
    :goto_1
    iget-boolean v0, p0, Lrexsee/advertisement/RexseeAdBars;->syncTag:Z

    if-nez v0, :cond_0

    .line 91
    const-wide/16 v0, 0x14

    :try_start_0
    invoke-static {v0, v1}, Ljava/lang/Thread;->sleep(J)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_1

    .line 92
    :catch_0
    move-exception v0

    goto :goto_1
.end method

.method public exists(Ljava/lang/String;)Z
    .locals 1
    .param p1, "id"    # Ljava/lang/String;

    .prologue
    .line 58
    iget-object v0, p0, Lrexsee/advertisement/RexseeAdBars;->mMap:Ljava/util/HashMap;

    invoke-virtual {v0, p1}, Ljava/util/HashMap;->containsKey(Ljava/lang/Object;)Z

    move-result v0

    return v0
.end method

.method public getIds()Ljava/lang/String;
    .locals 6

    .prologue
    const-string v5, "\""

    .line 61
    const-string v2, ""

    .line 62
    .local v2, "rtn":Ljava/lang/String;
    iget-object v3, p0, Lrexsee/advertisement/RexseeAdBars;->mMap:Ljava/util/HashMap;

    invoke-virtual {v3}, Ljava/util/HashMap;->keySet()Ljava/util/Set;

    move-result-object v0

    .line 63
    .local v0, "ids":Ljava/util/Set;, "Ljava/util/Set<Ljava/lang/String;>;"
    invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v1

    .line 64
    .end local p0    # "this":Lrexsee/advertisement/RexseeAdBars;
    .local v1, "iterator":Ljava/util/Iterator;, "Ljava/util/Iterator<Ljava/lang/String;>;"
    :goto_0
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v3

    if-nez v3, :cond_0

    .line 68
    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "["

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v3, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, "]"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    return-object v3

    .line 65
    :cond_0
    const-string v3, ""

    invoke-virtual {v2, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-nez v3, :cond_1

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-static {v2}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v4

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v4, ","

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 66
    :cond_1
    new-instance v3, Ljava/lang/StringBuilder;

    invoke-static {v2}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v4

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v4, "\""

    invoke-virtual {v3, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object p0

    check-cast p0, Ljava/lang/String;

    invoke-virtual {v3, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, "\""

    invoke-virtual {v3, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    goto :goto_0
.end method

.method public getInfo(Ljava/lang/String;)Ljava/lang/String;
    .locals 5
    .param p1, "id"    # Ljava/lang/String;

    .prologue
    const-string v4, "\""

    .line 142
    iget-object v2, p0, Lrexsee/advertisement/RexseeAdBars;->mMap:Ljava/util/HashMap;

    invoke-virtual {v2, p1}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lrexsee/advertisement/AdDiv;

    .line 143
    .local v0, "adDiv":Lrexsee/advertisement/AdDiv;
    if-nez v0, :cond_0

    const-string v2, "{}"

    .line 148
    :goto_0
    return-object v2

    .line 144
    :cond_0
    const-string v1, ""

    .line 145
    .local v1, "rtn":Ljava/lang/String;
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v3, "\"id\":\""

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    iget-object v3, v0, Lrexsee/advertisement/AdDiv;->mId:Ljava/lang/String;

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, "\""

    invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    .line 146
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v3, ",\"vendor\":\""

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    iget-object v3, v0, Lrexsee/advertisement/AdDiv;->mVendor:Ljava/lang/String;

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, "\""

    invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    .line 147
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v3, ",\"key\":\""

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    iget-object v3, v0, Lrexsee/advertisement/AdDiv;->mKey:Ljava/lang/String;

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, "\""

    invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    .line 148
    new-instance v2, Ljava/lang/StringBuilder;

    const-string v3, "{"

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, "}"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    goto :goto_0
.end method

.method public getInheritInterface(Lrexsee/core/browser/Browser;)Lrexsee/core/browser/clazz/JavascriptInterface;
    .locals 0
    .param p1, "childBrowser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 22
    return-object p0
.end method

.method public getInterfaceName()Ljava/lang/String;
    .locals 2

    .prologue
    .line 18
    new-instance v0, Ljava/lang/StringBuilder;

    iget-object v1, p0, Lrexsee/advertisement/RexseeAdBars;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v1, v1, Lrexsee/core/browser/Browser;->application:Lrexsee/core/application/RexseeApplication;

    iget-object v1, v1, Lrexsee/core/application/RexseeApplication;->resources:Lrexsee/core/application/Resource;

    iget-object v1, v1, Lrexsee/core/application/Resource;->prefix:Ljava/lang/String;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v1, "AdBars"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getMap()Ljava/util/HashMap;
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/HashMap",
            "<",
            "Ljava/lang/String;",
            "Lrexsee/advertisement/AdDiv;",
            ">;"
        }
    .end annotation

    .prologue
    .line 51
    iget-object v0, p0, Lrexsee/advertisement/RexseeAdBars;->mMap:Ljava/util/HashMap;

    return-object v0
.end method

.method public getNewInterface(Lrexsee/core/browser/Browser;)Lrexsee/core/browser/clazz/JavascriptInterface;
    .locals 0
    .param p1, "childBrowser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 26
    return-object p0
.end method

.method public isReady(Ljava/lang/String;)Z
    .locals 1
    .param p1, "adVendor"    # Ljava/lang/String;

    .prologue
    .line 55
    invoke-static {p1}, Lrexsee/advertisement/AdDiv;->isVendorReady(Ljava/lang/String;)Z

    move-result v0

    return v0
.end method

.method public refresh(Ljava/lang/String;)V
    .locals 2
    .param p1, "id"    # Ljava/lang/String;

    .prologue
    .line 151
    iget-object v1, p0, Lrexsee/advertisement/RexseeAdBars;->mMap:Ljava/util/HashMap;

    invoke-virtual {v1, p1}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lrexsee/advertisement/AdDiv;

    .line 152
    .local v0, "adDiv":Lrexsee/advertisement/AdDiv;
    if-eqz v0, :cond_0

    invoke-virtual {v0}, Lrexsee/advertisement/AdDiv;->refresh()V

    .line 153
    :cond_0
    return-void
.end method

.method public remove()V
    .locals 2

    .prologue
    .line 99
    const/4 v0, 0x0

    iput-boolean v0, p0, Lrexsee/advertisement/RexseeAdBars;->syncTag:Z

    .line 100
    iget-object v0, p0, Lrexsee/advertisement/RexseeAdBars;->mActivity:Landroid/app/Activity;

    new-instance v1, Lrexsee/advertisement/RexseeAdBars$2;

    invoke-direct {v1, p0}, Lrexsee/advertisement/RexseeAdBars$2;-><init>(Lrexsee/advertisement/RexseeAdBars;)V

    invoke-virtual {v0, v1}, Landroid/app/Activity;->runOnUiThread(Ljava/lang/Runnable;)V

    .line 113
    :goto_0
    iget-boolean v0, p0, Lrexsee/advertisement/RexseeAdBars;->syncTag:Z

    if-eqz v0, :cond_0

    .line 120
    return-void

    .line 115
    :cond_0
    const-wide/16 v0, 0x14

    :try_start_0
    invoke-static {v0, v1}, Ljava/lang/Thread;->sleep(J)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 116
    :catch_0
    move-exception v0

    goto :goto_0
.end method

.method public remove(Ljava/lang/String;)V
    .locals 3
    .param p1, "id"    # Ljava/lang/String;

    .prologue
    .line 122
    iget-object v1, p0, Lrexsee/advertisement/RexseeAdBars;->mMap:Ljava/util/HashMap;

    invoke-virtual {v1, p1}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lrexsee/advertisement/AdDiv;

    .line 123
    .local v0, "adDiv":Lrexsee/advertisement/AdDiv;
    if-nez v0, :cond_1

    .line 140
    :cond_0
    return-void

    .line 124
    :cond_1
    const/4 v1, 0x0

    iput-boolean v1, p0, Lrexsee/advertisement/RexseeAdBars;->syncTag:Z

    .line 125
    iget-object v1, p0, Lrexsee/advertisement/RexseeAdBars;->mActivity:Landroid/app/Activity;

    new-instance v2, Lrexsee/advertisement/RexseeAdBars$3;

    invoke-direct {v2, p0, v0, p1}, Lrexsee/advertisement/RexseeAdBars$3;-><init>(Lrexsee/advertisement/RexseeAdBars;Lrexsee/advertisement/AdDiv;Ljava/lang/String;)V

    invoke-virtual {v1, v2}, Landroid/app/Activity;->runOnUiThread(Ljava/lang/Runnable;)V

    .line 133
    :goto_0
    iget-boolean v1, p0, Lrexsee/advertisement/RexseeAdBars;->syncTag:Z

    if-nez v1, :cond_0

    .line 135
    const-wide/16 v1, 0x14

    :try_start_0
    invoke-static {v1, v2}, Ljava/lang/Thread;->sleep(J)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 136
    :catch_0
    move-exception v1

    goto :goto_0
.end method

.method public size()I
    .locals 1

    .prologue
    .line 71
    iget-object v0, p0, Lrexsee/advertisement/RexseeAdBars;->mMap:Ljava/util/HashMap;

    invoke-virtual {v0}, Ljava/util/HashMap;->size()I

    move-result v0

    return v0
.end method
